package com.lqk.java1;

import java.lang.reflect.Field;
import java.lang.reflect.Method;

/**
 * @author liqiankun
 * @date 2022/11/10 17:34
 * @description
 **/
public class Test {
    @org.junit.Test
    public void test1(){
        Class clazz = Person.class;
        /**
         * getMethods(): 获取当前运行时类及其所有父类中声明为public的方法
         */
//        Method[] methods = clazz.getMethods();
//        for (Method method : methods) {
//            System.out.println(method);
//        }

        Field[] fields = clazz.getFields();
        for (Field field : fields) {
            System.out.println(field);
        }
    }
}
